<?php
require_once __DIR__ . "/fast_theme/base.php";

use fast\Controller;

/* carousel */
$carousel      = [];
$carousel_text = $this->options->JIndex_Carousel;
if ($carousel_text) {
    $carousel_arr = explode("\r\n", $carousel_text);
    if (count($carousel_arr) > 0) {
        for ($i = 0, $iMax = count($carousel_arr); $i < $iMax; $i++) {
            $img        = explode("||", $carousel_arr[$i])[0];
            $url        = explode("||", $carousel_arr[$i])[1];
            $title      = explode("||", $carousel_arr[$i])[2];
            $carousel[] = array("img" => trim($img), "url" => trim($url), "title" => trim($title));
        }
    }
}
$recommend      = [];
$recommend_text = $this->options->JIndex_Recommend;
if ($recommend_text) {
    $recommend_arr = explode("||", $recommend_text);
    (count($recommend_arr) === 2) && $recommend = $recommend_arr;
}

/* index_ad */
$index_ad_text = $this->options->JIndex_Ad;
$index_ad      = null;
if ($index_ad_text) {
    $index_ad_arr = explode("||", $index_ad_text);
    (count($index_ad_arr) === 2) && $index_ad = array("image" => trim($index_ad_arr[0]), "url" => trim($index_ad_arr[1]));
}

/* index_notice */
$index_notice_text = $this->options->JIndex_Notice;
$index_notice      = null;
if ($index_notice_text) {
    $index_notice_arr = explode("||", $index_notice_text);
    (count($index_notice_arr) === 2) && $index_notice = array("text" => trim($index_notice_arr[0]), "url" => trim($index_notice_arr[1]));
}

require_once Controller::instance()->view->fetch();